#define _GNU_SOURCE
#include "app_pool.h"
#include "log/log.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

int task_func(void *arg)
{
    char *name = (char *)arg;
    log_debug("name: %s, tid: %d", name, gettid());
}
int main(int argc, char const *argv[])
{
    log_debug("main线程(%d)执行", gettid());

    // 初始化线程池
    app_pool_init(5);

    // 注册多个任务
    for (int i = 0; i < 10; i++)
    {
        char *data = malloc(10);
        sprintf(data, "abc_%d", i);
        app_pool_registerTask(task_func, data);
    }

    sleep(1);

    app_pool_close();
    return 0;

}